﻿using System;
using ExplorerPlus.DomainObjects;

namespace ExplorerPlus.PluginsInterface
{
    /// <summary>
    /// A category item-specific plugin interface 
    /// </summary>
    public interface IItemDetailViewPlugin : IDisposable
    {
        /// <summary>
        /// Returns an item detail user control to be rendered for editing an item.
        /// </summary>
        System.Windows.Forms.UserControl ItemDetailView { get; }

        /// <summary>
        /// Detects if changes are made to the item.
        /// </summary>
        bool HasChanges { get; set; }

        /// <summary>
        /// Bypass the new\edited item to the interface for displaying it.
        /// </summary>
        /// <param name="item">new\edited item</param>
        void Initialize(Item item);

        /// <summary>
        /// Returns the new\edited item to the parent window.
        /// </summary>
        /// <returns>new\edited item</returns>
        Item GetItem();

        /// <summary>
        /// Performs any validation required for the current item (ex: mandatory fields, field format, etc.)
        /// </summary>
        /// <returns>True, if valid. Otherwise, false.</returns>
        bool Validate();

        /// <summary>
        /// This method is called before saving an item.
        /// This is helpful to clear any changes to the user control and download any required images.
        /// </summary>
        /// <returns>new\edited item</returns>
        Item Store();

        /// <summary>
        /// This method is called when a file is dragged and dropped into the application.
        /// </summary>
        /// <param name="filePath"></param>
        void DragDropFile(string[] filePath);
    }
}
